package web.bdelegate;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.Iterator;
import beans.CajaVO;
import beans.MesaVO;
import beans.PedidoVO;
import beans.RestauranteVO;
import beans.SolicitudReposicionVO;

import web.rmi.IfazRestaurante;


@SuppressWarnings("unused")
public class BDelegate_Web extends UnicastRemoteObject{

	private static final long serialVersionUID = 1L;
	private IfazRestaurante ifazRest;
	
	public BDelegate_Web() throws RemoteException 
	{
		super();
		getConexion();
	}
	

	private void getConexion() 
	{
		try 
		{
			ifazRest = (IfazRestaurante) Naming.lookup("//localhost/Restaurante");
		} 
		catch (Exception e) 
		{
			e.printStackTrace();
		} 
	}

	public MesaVO abrirMesa(String nroMesa, String cantPersonas) 
	{
		try 
		{
			return 	ifazRest.abrirMesa(nroMesa , cantPersonas);
		} 
		catch (RemoteException e) 
		{
			e.printStackTrace();
		}
		return null;
	}

	public MesaVO cerrarMesa(String nroMesa) 
	{
		try 
		{
			return 	ifazRest.cerrarMesa(nroMesa);
		} 
		catch (RemoteException e) 
		{
			e.printStackTrace();
		}
		return null;
	}

	public MesaVO liberarMesa(String nroMesa) 
	{
		try 
		{
			return 	ifazRest.liberarMesa(nroMesa);
		} 
		catch (RemoteException e) 
		{
			e.printStackTrace();
		}
		return null;
	}

	public CajaVO abrirCaja() 
	{
		try 
		{
			return 	ifazRest.abrirCaja();
		} 
		catch (RemoteException e) 
		{
			e.printStackTrace();
		}
		return null;
	}

	public CajaVO cerrarCaja(String montoAMano) 
	{
		try 
		{
			return 	ifazRest.cerrarCaja(montoAMano);
		} 
		catch (RemoteException e) 
		{
			e.printStackTrace();
		}
		return null;
	}

	public RestauranteVO abrirRestaurante(String id) 
	{
		try 
		{
			return ifazRest.abrirRestaurante(id);
		} 
		catch (RemoteException e) 
		{
			e.printStackTrace();
		}
		return null;
	}


	public SolicitudReposicionVO obtenerSolicitudRep(String sector) 
	{
		try 
		{
			return ifazRest.obtenerSolicitudRep(sector);
		} 
		catch (RemoteException e) 
		{
			e.printStackTrace();
		}
		return null;
	}


	public PedidoVO generarPedido(ArrayList<Integer> idPlatos,
			int numeroMesa, int dniMozo, boolean isFacturable) 
	{
		try 
		{
			return ifazRest.generarPedido(idPlatos, numeroMesa, dniMozo, isFacturable);
		} 
		catch (RemoteException e) 
		{
			e.printStackTrace();
		}
		return null;
	}
}
